package com.hicoffee.bm.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.radarwin.framework.jsonhelp.DateTimeJsonDeserializer;
import com.radarwin.framework.jsonhelp.DateTimeJsonSerializer;

import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by lewis on 2017/7/11.
 */
public abstract class BaseModel implements Serializable {


    private static final long serialVersionUID = 194237244180644603L;


    @Column(name = "deleted", insertable = false)
    private Boolean deleted;

    @Column(name = "create_user")
    private String createUser;

    @Column(name = "create_time", insertable = false, updatable = false)
    private Date createTime;

    @Column(name = "update_user")
    private String updateUser;

    @Column(name = "update_time", insertable = false, updatable = false)
    private Date updateTime;

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    @JsonSerialize(
            using = DateTimeJsonSerializer.class
    )
    public Date getCreateTime() {
        return createTime;
    }

    @JsonDeserialize(
            using = DateTimeJsonDeserializer.class
    )
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    @JsonSerialize(
            using = DateTimeJsonSerializer.class
    )
    public Date getUpdateTime() {
        return updateTime;
    }

    @JsonDeserialize(
            using = DateTimeJsonDeserializer.class
    )
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
